<template>
  <div class="home">
    <top-view></top-view>
    <sales-view></sales-view>
    <bottom-view></bottom-view>
    <map-view></map-view>
  </div>
</template>

<script>
import TopView from '../components/TopView'
import SalesView from '../components/SalesView'
import BottomView from '../components/BottomView'
import MapView from '../components/MapView'
import { wordcloud, mapScatter, screenData } from '../api/index'
export default {
  name: 'Home',
  components: {
    TopView,
    SalesView,
    BottomView,
    MapView
  },
  methods: {
    getReportData() {
      return this.reportData
    },
    getWordCloud() {
      return this.wordCloud
    },
    getMapData() {
      return this.mapData
    }
  },
  // 继承 - inject provide 在 created之前执行，固使用方法进行获取
  provide() {
    return {
      getReportData: this.getReportData,
      getWordCloud: this.getWordCloud,
      getMapData: this.getMapData
    }
  },
  mounted() {
    screenData().then((data) => {
      this.reportData = data
    })
    wordcloud().then((data) => {
      this.wordCloud = data
    })
    mapScatter().then((data) => {
      this.mapData = data
    })
  }
}
</script>
<style lang="scss">
.home {
  width: 100%;
  background: #eee;
  padding: 20px;
  box-sizing: border-box;
  min-height: 100%;
}
</style>
